<?php
include("inc/class.otr.php");
$otr = new OTR();

if(!$otr->checkLogin()){
	header("Location: index.php");
}

if(isset($_REQUEST['id'])){

		$project = $otr->getProject($_REQUEST['id']);
		//print_r($project);
		$project_id = $project['id'];
		$project_shortname = $project['shortname'];
		$project_description = $project['description'];
		$project_local = $project['local'];
		$project_site = $project['site'];
		$project_customer = $project['customer_id'];
		$project_started = $project['started_date'];
		$project_ended = $project['completed_date'];
		$project_completed = $project['completed'];
/*
		$project_mysqlhost = $project['mysql_host'];
		$project_mysqldb = $project['mysql_db'];
		$project_mysqluser = $project['mysql_user'];
		$project_mysqlpass = $project['mysql_pass'];
		$project_phpmyadminhost = $project['phpmyamin_host'];
		$project_phpmyadminuser = $project['phpmyamin_user'];
		$project_phpmyadminpass = $project['phpmyamin_pass'];
		$project_ftphost = $project['ftp_host'];
		$project_ftpuser = $project['ftp_user'];
		$project_ftppass = $project['ftp_pass'];
*/
}
?>
<div id="project" style="float: left;">
<form id="frm_project" method="post" action="project.php">
<input id="txt_id" name="txt_id" type="hidden" readonly="readonly" value="<?php echo($project_id);?>" />
<table>
	<tr>
		<td style="font-size: 17px; font-weight:bold;"><?php echo($project_shortname);?></td>
	</tr>
	<tr>
		<td><?php echo($project_description);?></td>
	</tr>
	<tr>
		<td><a target="_blank" href="<?php echo($project_local);?>">local</a></td>
	</tr>
	<tr>
		<td><a target="_blank" href="<?php echo($project_site);?>">site</a></td>
	</tr>
	<tr>
		<td><?php echo($project_started);?></td>
	</tr>
	<tr>
		<td>Total accumulated time: <div id="div_project_total"></div></td>
	</tr>
	<tr>
		<td>Running for days: <?php echo($project_started);?></td>
	</tr>
	<tr>
		<td>
			<div id="pnl_result"></div>
		</td>
	</tr>
</table>
</form>
</div>
<div id="div_tasks"></div>
<div id="div_hours"></div>
<script type="text/javascript">
	var saveProject = function(){
		ajaxPost($('frm_project'), "project.php", $('pnl_result'), null);
	}
	var setCheckbox = function(el, value){
		if(value){
			el.value = 1;
		}else{
			el.value = 0;			
		}
	}
	ajaxGet('tasks.php', 'id=<?php echo($project_id);?>', $('div_tasks'), null);
	ajaxGet('functions.php', 'function=projecttotal&projectid=<?php echo($project_id);?>', $('div_project_total'));
</script>






